﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>APP添加页面</title>
    <!-- Bootstrap -->
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet">
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="/CSS/Base/BaseClass.css" rel="stylesheet" type="text/css" />
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/Scripts/jquery-migrate-1.1.0.min.js"></script>
    <script src="/JqueryPlug/layer/layer/layer.js"></script>
    <script src="/Scripts/avalon.min.js"></script>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/Scripts/SZHLCommon.js"></script>
    <style>
        .pCard {
            min-width: 80px;
            text-align: center;
            margin: 0 5px 5px 5px;
        }
    </style>

    <script>
        $.ajaxSetup({
            async: false
        });
        var addmodel = avalon.define({
            $id: "APP_ADD",
            TempCode: "/View/TempHTML/" + ComFunJS.getQueryString("FormCode"),
            FrameName: ComFunJS.getQueryString("FrameName") ? ComFunJS.getQueryString("FrameName") : "main",
            spReason: "",
            render: function () {
                avalon.templateCache = null;
                ComFunJS.initForm();
            },
            SaveData: function (dom, status) {
                var errmsg = "";
                errmsg = addmodel.CheckData();
                if (errmsg !== "") {
                    layer.tips(errmsg, dom);
                }
                else {
                    if (confirm('你确定要保存吗？')) {
                        $(dom).addClass("disabled").find("i").show();
                        if (typeof (getSPdata) === "function") {
                            var action = getSPdata(addmodel.spReason, status);
                            $.post("/API/FTAPI.ashx", action, function (result) {
                                var jsonresult = $.parseJSON(result)
                                $(dom).removeClass("disabled").find("i").hide();
                                if ($.trim(jsonresult.ErrorMsg) != "") {
                                    ComFunJS.winwarning(jsonresult.ErrorMsg);
                                } else {
                                    ComFunJS.winsuccessnew("操作成功");
                                    $("input[type=button]").prop("disabled", true);
                                    try {
                                        if (parent.frames[addmodel.FrameName].window.model) {
                                            parent.frames[addmodel.FrameName].window.model.CommonData.push(jsonresult.Result)
                                        }
                                    } catch (e) {
                                        //  location.reload();
                                    }

                                }
                            });
                        } else {
                            alert("error")
                        }
                    }
                }
            },
            CheckData: function () {
                var retmsg = "";
                if ($(".szhl_require")) {
                    $(".szhl_require").each(function () {
                        if ($(this).val() == "") {
                            retmsg = $(this).parent().parent().find("label").text() + "不能为空";
                        }
                    })
                }
                return retmsg;
            },
            qx: function () {
                parent.layer.closeAll();
            }

        })
        avalon.ready(function () {
            ComFunJS.initsetajax();
        })
    </script>
</head>
<body ms-controller="APP_ADD">
    <div class="container-fluid" style="margin-top: 20px;margin-bottom:100px" ms-include-src="{{TempCode}}.html" data-include-rendered='render'>
    </div>
    <table class="table navbar-fixed-bottom" style="background-color: #F3F6F8;">
        <tbody>
            <tr>
                <td class="text-center" id="btTD" height="60px">
                    <div class="input-group" style="height:40px">
                        <span class="input-group-addon">处理意见</span>
                        <input type="text" placeholder="此处填写处理意见,按ENTER键签核通过" ms-duplex="spReason" style="height:40px" class="form-control szhl_require">
                        <span class="input-group-btn" >
                            <input type="button" class="btn btn-danger" ms-click="SaveData(this,-1)" value="退回" style="height:40px" />
                            <input type="button" class="btn btn-success" style="width:100px;height:40px" ms-click="SaveData(this,1)" value="审核" />
                        </span>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
    <link href="/JqueryPlug/umeditor122/themes/default/css/umeditor.css" type="text/css" rel="stylesheet" />
    <script src="/JqueryPlug/umeditor122/umeditor.js" type="text/javascript" charset="utf-8"></script>
    <script src="/JqueryPlug/umeditor122/umeditor.config.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>